#include "DynamicArray.h"
#include "student.h"
#include <iostream>

int main()
{
    DynamicArray a;
    DynamicArray b;

    a.SetFreeFunc(Student::Free);
    a.SetComprFunc(Student::compare);
    a.SetComprFunc(Student::AllCompare);
    a.SetPrintFunc(Student::print);

    // b.SetFreeFunc(Student::Free);
    // b.SetComprFunc(Student::compare);
    // b.SetComprFunc(Student::AllCompare);
    // b.SetPrintFunc(Student::print);

    Student *s1 = new Student(1, "zhangsan");
    Student *s2 = new Student(2, "lisi");
    // Student s2(2,"lisi");
    Student *s3 = new Student(3, "wangwu");

    Student *s5 = new Student(5, "wangwu2");

    Student *s7 = new Student(7, "wangwu4");

    a.InsertTail((ElementType)s1);
    a.InsertTail((ElementType)s2);
    a.InsertTail((ElementType)s3);
    a.InsertTail((ElementType)s5);
    a.UpdateByIndex(1, (ElementType)s7);

    a.Sort();
    a.show();

    b = a;
    a.show();
    // a.InsertByIndex((ElementType)s4,3);
    // a.InsertTail((ElementType)s1);

    // b.InsertTail((ElementType)s1);
    // b.InsertTail((ElementType)&s2);

    // a.InsertHead((ElementType)s4);

    // b.SetComprFunc(Student::compare);
    // b.SetComprFunc(Student::AllCompare);

    // a.Sort();
    // b.Sort();
    // a.RemoveByElement((ElementType)s3);
    // a.RemoveByIndex(0);
    // a.UpdateByElement((ElementType)s1,(ElementType)s5);
    // a.FindByElement((ElementType)s3);
    // a.Sort();
    // DynamicArray c = a.Merge(b);
    // DynamicArray c = a.FindDifference(b);
    // // a.Duplicate();
    // c.SetPrintFunc(Student::print);
    // b.show();

    return 0;
}
